home *** CD-ROM | disk | FTP | other *** search
Wrap
VERSION 5.00 Begin VB.Form frmErase BorderStyle = 3 'Fixed Dialog Caption = "Erase Re-Writable CD" ClientHeight = 1875 ClientLeft = 2760 ClientTop = 3750 ClientWidth = 5490 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 1875 ScaleWidth = 5490 ShowInTaskbar = 0 'False StartUpPosition = 1 'CenterOwner Begin VB.CommandButton cmdCancel Caption = "&Cancel" Height = 375 Left = 4065 TabIndex = 4 Top = 525 Width = 1215 End Begin VB.CheckBox chkQuikErase Caption = "Perform Quick Erase" Height = 225 Left = 300 TabIndex = 1 Top = 180 Value = 1 'Checked Width = 2160 End Begin VB.CommandButton cmdErase Caption = "&Erase" Height = 375 Left = 4065 TabIndex = 0 Top = 90 Width = 1215 End Begin VB.Label lblStatus Alignment = 2 'Center BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 240 Left = 1140 TabIndex = 3 Top = 1560 Width = 3210 End Begin VB.Label lblEraseMsg Caption = $"frmErase.frx":0000 Height = 960 Left = 285 TabIndex = 2 Top = 495 Width = 3525 End Attribute VB_Name = "frmErase" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Private WithEvents mobjCDPro As CDWriterPro Attribute mobjCDPro.VB_VarHelpID = -1 Private mblnErasing As Boolean '**************************************************************** '**************************************************************** 'COPYRIGHT 2003 NUMEDIA SOFT, INC. 'This is a sample of how you could use the DVDWriterPro control. 'There are improvements which could be made rather easily. 'Feel free to modify it as you see fit. '**************************************************************** '**************************************************************** Private Sub cmdCancel_Click() 'Unload Unload Me End Sub Private Sub cmdErase_Click() Dim MediaType As eMediaType Dim bCanErase As Boolean 'Lets get the media type MediaType = mobjCDPro.GetMediaType() 'Check for media If MediaType = mtNotLoaded Then MsgBox "No Media Loaded.", vbOKOnly + vbInformation, App.Title Unload Me Exit Sub End If 'Is media rewritable type If (MediaType <> mtCDRW) And (MediaType <> mtDVDMRW) And _ (MediaType <> mtDVDRam) And (MediaType <> mtDVDPRW) Then 'Msg to user MsgBox "The current media is not Re-Writable.", vbOKOnly + vbInformation, App.Title Unload Me Exit Sub End If 'Defualt Erase flag bCanErase = False 'Check to see if drive is capable of erasing this type of media If (mobjCDPro.GetDriveCapabilityFlag(WriteCDRW) = True) And (MediaType = mtCDRW) Then bCanErase = True ElseIf (mobjCDPro.GetDriveCapabilityFlag(WriteDVDRW) = True) And (MediaType = mtDVDMRW) Then bCanErase = True ElseIf (mobjCDPro.GetDriveCapabilityFlag(WriteDVDRam) = True) And (MediaType = mtDVDRam) Then bCanErase = True ElseIf (mobjCDPro.GetDriveCapabilityFlag(WriteDVDPRW) = True) And (MediaType = mtDVDPRW) Then bCanErase = True Else MsgBox "Selected drive does not support Re-Writable discs of this format.", vbOKOnly + vbInformation, App.Title Unload Me Exit Sub End If 'Erase Disc..Quick ? If mobjCDPro.EraseDisc(chkQuikErase.Value = vbChecked) = False Then 'Erase command not accepted MsgBox "Error Erasing Disc!!!", vbCritical, App.Title Unload Me End If End Sub Public Sub ShowErase(objCDR As CDWriterPro) 'Set an instance of CDR so we can capture events on this form Set mobjCDPro = objCDR 'Enable buttons cmdCancel.Enabled = True cmdErase.Enabled = True 'Set flag to false mblnErasing = False 'Show me Me.Show vbModal End Sub Private Sub Form_Unload(Cancel As Integer) 'Dont allow exit if erasing If mblnErasing = True Then Cancel = 1 'Cancel Exit Exit Sub End If 'Kill form level object Set mobjCDPro = Nothing End Sub Private Sub mobjCDPro_EraseDiscComplete() 'Send a message to the user that erase is complete lblStatus.Caption = "Erase operation complete!!!" MsgBox "Erase Completed!!!", vbOKOnly + vbInformation, App.Title 'Enable buttons cmdCancel.Enabled = True cmdErase.Enabled = True 'Set flag to false so we can unload the form mblnErasing = False 'Unload Unload Me End Sub Private Sub mobjCDPro_EraseDiscStart() 'Set flag to True so we cannot unload the form until we are done erasing mblnErasing = True 'Send message to user lblStatus.Caption = "Erasing Disc...Please Wait!!" 'Disable buttons cmdCancel.Enabled = False cmdErase.Enabled = False End Sub Private Sub mobjCDPro_WriteError(ByVal WriteError As CDRPROXLibCtl.eWriteErrorType, ByVal DriveError As CDRPROXLibCtl.eCDError, ByVal sErrorInfo As String, ByVal sSenseInfo As String) Dim strError As String 'Get the error type and strError = "Writing Error: (" & CStr(WriteError) & ") " & sErrorInfo & vbCrLf 'If it is a drive error, add the drive error information 'to the displayed message If WriteError = errDriveError Then strError = strError & GetDriveErrorMessage(DriveError) & vbCrLf & " Error Sense Data: " & sSenseInfo End If 'Display Msg to user MsgBox strError, vbCritical + vbOKOnly 'Reset buttons so we can unload cmdCancel.Enabled = True cmdErase.Enabled = True 'Set flag so the user can unload the form mblnErasing = False End Sub